package com.tuling.controller;

import com.tuling.common.Result;
import com.tuling.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "组员信息维护")
@RestController
public class UserController {

    @Resource
    private UserService userService;


    /**
     * 更改用户名密码
     */
    @ApiOperation(value = "修改密码",notes = "修改密码")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userName",
                    value = "用户名",
                    required = true,
                    paramType = "query"
            )
            ,
            @ApiImplicitParam(name = "oldPassword",
                    value = "旧密码",
                    required = true,
                    paramType = "query"
            ),
            @ApiImplicitParam(name = "newPassword",
                    value = "新密码",
                    required = true,
                    paramType = "query"
            )
    })
    @GetMapping("/update_password")
    public Result<Boolean> updatePassword(String userName, String oldPassword, String newPassword){
        return userService.updatePassword(userName, oldPassword, newPassword);
    }
}
